package com.kk;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class Launch2 extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        Button button = new Button("按钮");
        button.setOnMouseClicked(
                event -> {
                    System.out.println("点击按钮");
                }
        );
        StackPane stackPane = new StackPane();
        stackPane.getChildren().add(button);


        Scene scene = new Scene(stackPane, 400, 400);
        primaryStage.setScene(scene);
        scene.setOnMouseClicked(event -> {
            System.out.println("..点击场景");
        });

        primaryStage.show();

    }
}
